#Import necessary Libraries
#Data Manipulation/Statistics
import pandas as pd
from scipy import stats
#Visualization
import matplotlib.pyplot as plt
import plotly.express as px
#Sensor data analysis
import sensormotion as sm
#Resetting the pandas warnings
pd.options.mode.chained_assignment = None # default='warn
%%time
#Load the dataset
colnames=['TIMESTAMP', 'X', 'Y', 'Z']
df = pd.read_excel('Test Data.xlsx', names=colnames, header=None )
df.head()
In this section, we have selected the data between the timestamp range of "2018-07-23 08:30:00.000" and "2018-07-23 09:40:00.000"
#Change the start and end timeStamp to select data according to the requirement
StartTimestamp = '2018-07-23 08:30:00.000'
EndTimestamp = '2018-07-23 09:40:00.000'
dfTimeUpd = df[df['TIMESTAMP'].between(StartTimestamp,EndTimestamp)]
dfTimeUpd.head()
fig, ax = plt.subplots(nrows=3, ncols=1, figsize=(15,10))
ax[0].set_title('Raw X')
ax[0].plot(dfTimeUpd['TIMESTAMP'], dfTimeUpd['X'], linewidth=0.5, color='k')
ax[1].set_title('Raw Y')
ax[1].plot(dfTimeUpd['TIMESTAMP'], dfTimeUpd['Y'], linewidth=0.5, color='k')
ax[2].set_title('Raw Z')
ax[2].plot(dfTimeUpd['TIMESTAMP'], dfTimeUpd['Z'], linewidth=0.5, color='k')
fig.subplots_adjust(hspace=.5)
#Visualize the data for Z axis
fig = px.line(dfTimeUpd, x='TIMESTAMP', y='Z', title='Finding visual patterns along Z-axis')
fig.update_xaxes(rangeslider_visible=True)
fig.show()